#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

#这种模式是直接在构建镜像的内部编译发布dotnet项目。
#注意下容器内输出端口是9291
#如果你想先手动dotnet build成可执行的二进制文件，然后再构建镜像，请看.Api层下的dockerfile。


FROM mcr.microsoft.com/dotnet/aspnet:6.0-bullseye-slim AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim AS build
WORKDIR /src
COPY ["Ceri.Platform.CLMS.API.Api/Ceri.Platform.CLMS.API.Api.csproj", "Ceri.Platform.CLMS.API.Api/"]
COPY ["Ceri.Platform.CLMS.API.Extensions/Ceri.Platform.CLMS.API.Extensions.csproj", "Ceri.Platform.CLMS.API.Extensions/"]
COPY ["Ceri.Platform.CLMS.API.Tasks/Ceri.Platform.CLMS.API.Tasks.csproj", "Ceri.Platform.CLMS.API.Tasks/"]
COPY ["Ceri.Platform.CLMS.API.IServices/Ceri.Platform.CLMS.API.IServices.csproj", "Ceri.Platform.CLMS.API.IServices/"]
COPY ["Ceri.Platform.CLMS.API.Model/Ceri.Platform.CLMS.API.Model.csproj", "Ceri.Platform.CLMS.API.Model/"]
COPY ["Ceri.Platform.CLMS.API.Common/Ceri.Platform.CLMS.API.Common.csproj", "Ceri.Platform.CLMS.API.Common/"]
COPY ["Ceri.Platform.CLMS.API.Services/Ceri.Platform.CLMS.API.Services.csproj", "Ceri.Platform.CLMS.API.Services/"]
COPY ["Ceri.Platform.CLMS.API.Repository/Ceri.Platform.CLMS.API.Repository.csproj", "Ceri.Platform.CLMS.API.Repository/"]
COPY ["Ceri.Platform.CLMS.API.EventBus/Ceri.Platform.CLMS.API.EventBus.csproj", "Ceri.Platform.CLMS.API.EventBus/"]
RUN dotnet restore "Ceri.Platform.CLMS.API.Api/Ceri.Platform.CLMS.API.Api.csproj"
COPY . .
WORKDIR "/src/Ceri.Platform.CLMS.API.Api"
RUN dotnet build "Ceri.Platform.CLMS.API.Api.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Ceri.Platform.CLMS.API.Api.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
EXPOSE 9291 
ENTRYPOINT ["dotnet", "Ceri.Platform.CLMS.API.Api.dll"]
